<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		存
		<script type="text/javascript">
			//补充
			//localStorage是以键值对，key:value的形式保存数据
			//localStorage存普通值。
			window.localStorage.setItem("test1", "字符串");
			window.localStorage.setItem("age", 20);
			window.localStorage.setItem("b", true);
			//放数组和对象一样处理。都必须通过JSON的打包和解析过程
			let arr = [
				{type1: "肉类", type2: "猪肉", count: 1, unit: "箱", desc: "无"},
				{type1: "肉类", type2: "猪肉", count: 2, unit: "箱", desc: "无"},
				{type1: "肉类", type2: "猪肉", count: 3, unit: "箱", desc: "无"},
				{type1: "肉类", type2: "猪肉", count: 4, unit: "箱", desc: "无"}
			];
			window.localStorage.setItem("arr", JSON.stringify(arr));
			let obj = {type1: "肉类", type2: "猪肉", count: 1, unit: "箱", desc: "无"};
			
			console.log("保存成功")
		</script>
	</body>
</html>
